package vanillajdk8;

import java.util.*;
import java.util.stream.*;

/**
 *  Respuesta al Golfing de:
 *  URL: http://codegolf.stackexchange.com/questions/18556/count-sum-of-all-digits/	
 */
class CodeGolf {

    public static void main(String[] a) {
       System.out.println(Arrays.asList(IntStream.range(1,new Integer(a[0]))
                .mapToObj(s->s+"")
                .collect(Collectors.joining())
                .split(""))
                .stream()
                .map(Integer::valueOf)
                .reduce(0,Integer::sum));
    }
}
